<html>
<head>
    <title>自定义指令</title>
</head>
<body>

<#macro do_thrice>
    <#nested 1>
    <#nested 2>
    <#nested 3>
</#macro>

<#-- 宏调用 -->
<#-- 用户定义指令使用“;”而不是“as” -->
<@do_thrice ;x>
    ${x} Anything.
</@do_thrice>


<#-- 一个宏可以有多个循环变量 -->
<#macro repeat count>
    <#list 1..count as x>
        <#nested x, x/2, x==count>
    </#list>
</#macro>

<@repeat count=4 ; c, halfc, last>
    ${c}. ${halfc}<#if last> Last!</#if>
</@repeat>

<@repeat count=4 ; c, halfc>
    ${c}. ${halfc}
</@repeat>

<@repeat count=4>
    Just repeat it...
</@repeat>

</body>
</html>